
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;

public class MyUI extends JFrame
{
	private JTextField my_text_url = new JTextField();
	private JButton my_go_button = new JButton("GO TO URL!");
	private MultiThreadEnv my_multithread_env = new MultiThreadEnv();
	
	public MyUI()
	{
		setTitle("All your sites are belonging to tot to to us");
		setSize(400,400);
		setLayout(new GridLayout(2,1));
		setupGUI();
	}
	private void setupGUI()
	{
		this.add(my_text_url);
		my_go_button.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) {
				if ((!my_text_url.getText().toLowerCase().startsWith("http://")))
				{
					StringBuilder text_helper = new StringBuilder("http://");
					text_helper.append(my_text_url.getText());
					my_multithread_env.addKeyword("Pallet");
					my_multithread_env.addKeyword("ChocolateMilk");
					my_multithread_env.takeInputURL(text_helper.toString());
				}else
				{
					my_multithread_env.takeInputURL(my_text_url.getText().toLowerCase());	
				}
			}
		});
		this.add(my_go_button);
		setVisible(true);
	}
	public static void main(String... strings)
	{
		new MyUI();
	}
}
